// const cheerio = require("cheerio");
const fs = require("fs");
const path = require("path");
// const indexContent = fs.readFileSync(
//   path.resolve(__dirname, "lib/index.html"),
//   "utf-8"
// );
// const $ = cheerio.load(indexContent);
// const scriptTags = $("script");
// const cssTags = $('link[rel="stylesheet"]');
// // $('h2').addClass('welcome');
// // console.log($.html());
// const scriptSrcArr = [];
// const cssLinkArr = [];
// for (let script of scriptTags) {
//   scriptSrcArr.push(script.attribs.src.replace("/js/", "./js/"));
// }

// const template = `
// require('${scriptSrcArr[0]}')
// const main = require('${scriptSrcArr[1]}')
// module.exports = main
// `;
// fs.writeFileSync(path.resolve(__dirname, "./lib/index.js"), template, {
//   encoding: "utf-8",
// });
const cssFileContent = fs.readFileSync(
  path.resolve(__dirname, "lib/index.css"),"utf-8"
);
const newCssFileContent = cssFileContent
  .replace(/\/img\//g, "./img/")
  .replace(/\/fonts\//g, "./fonts/");
fs.writeFileSync(path.resolve(__dirname, "lib/index.css"), newCssFileContent, {
  encoding: "utf-8",
});
